You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > StatTimeSerAnalysis Class > StatTimeSerAnalysis Methods > SingleExpForecast Method > StatTimeSerAnalysis.SingleExpForecast Method ([In] TVec, [In] TVec, [In] double, [In] int, [In] int)
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
StatTimeSerAnalysis.SingleExpForecast Method ([In] TVec, [In] TVec, [In] double, [In] int, [In] int)

Single exponential forecast.

Syntax
C#
Visual Basic
public static void SingleExpForecast([In] TVec Y, [In] TVec YHat, [In] double Alpha, [In] int T, [In] int InitMethod);
Parameters 
Description 
[In] TVec Y 
Time series data set. 
[In] TVec YHat 
Time series forecasts. Size of the YHat vector are adjusted automatically. 
[In] double Alpha 
Overal smoothing parameter used for forecast. 
[In] int T 
Forecast values up to T period. 
[In] int InitMethod 
Defines how the initial values for S[0] are calculated. 

Forecasts time series values by using single exponential smoothing equations. For single exponential smoothing, the h period ahead forecast is given by: 

 

 

Load data, assume Alpha is 0.33, forecast 20 points past the last value.

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector Data = new Vector(0); Vector YHat = new Vector(0); Vector Residuals = new Vector(0); int NumPoints = 20; Data.LoadFromFile("aerosol_particles.vec"); // last point period = Data.Length-1 + NumPoints int T = Data.Length - 1 + NumPoints; StatTimeSerAnalysis.SingleExpForecast(Data, YHat, 0.33, T, 0); // YHat now stores estimates for YHat[1,...Length-1] // so, if we need residuals, we have to subtract // these values from y[1,...,Length-1) Residuals.Size(YHat); Residuals.Sub(Data, YHat, 1, 0, 0, YHat.Length); } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!